import 'package:base/utils/image_util.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:module_home/pages/home/home_logic.dart';

class HomeQuickWidget extends StatelessWidget {
  HomeLogic logic;

  HomeQuickWidget({super.key, required this.logic});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 16),
      child: Obx(() => GridView.builder(
            padding: EdgeInsets.zero,
            shrinkWrap: true,
            physics: NeverScrollableScrollPhysics(),
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 2,
                childAspectRatio: 2.6,
                crossAxisSpacing: 4,
                mainAxisSpacing: 4),
            itemCount: logic.domainVM.quickBarList.length,
            itemBuilder: (context, index) {
              final bar = logic.domainVM.quickBarList[index];
              return Center(
                child: ImageLoader.asset(
                    path: 'assets/images/slices/${bar.toString()}.png'),
              );
            },
          )),
    );
  }
}
